package com.mfs.proxy.test.longtcp;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;
import java.util.Scanner;

public class ProxyUser {
    public static void main(String[] args) throws IOException {
        String proxyIp = "192.168.1.215";
        Integer proxyPort = 59452;
        Socket socket = new Socket(proxyIp, proxyPort);
        Scanner sc = new Scanner(System.in);
        while (true) {
            OutputStream outputStream = socket.getOutputStream();
            System.out.println("Who are you?");
            String s = sc.nextLine();
            outputStream.write(s.getBytes());
            InputStream inputStream = socket.getInputStream();
            byte[] bytes = new byte[1024];
            int read = inputStream.read(bytes);
            String s1 = new String(bytes, 0, read);
            System.out.println(s1);
        }

    }
}
